#pragma once

using std::cout;
using std::endl;

struct ITransport
{
    virtual ~ITransport() { }

    virtual void Run() = 0;
};

class CBike : public ITransport
{
public:
    virtual void Run() override
    {
        cout << "Bike" << endl;
    }
};

class CBus : public ITransport
{
public:
    virtual void Run() override
    {
        cout << "Bus" << endl;
    }
};

class CCar : public ITransport
{
public:
    virtual void Run() override
    {
        cout << "Car" << endl;
    }
};

class CTourist
{
    ITransport* m_lpITransport;

    CTourist() { }

public:
    CTourist(ITransport* lpITransport) : m_lpITransport(lpITransport) { }
    virtual ~CTourist()
    {
        if (m_lpITransport)
            delete m_lpITransport;
    }

public:
    void Travel()
    {
        if (m_lpITransport)
            m_lpITransport->Run();
    }
};
